package com.cci.kangdao.service.impl;

import com.cci.kangdao.dao.RemindTaskTDao;
import com.cci.kangdao.dao.WorkOrderRepairDao;
import com.cci.kangdao.service.RemindTaskService;
import com.cci.kangdao.utilTool.StringToool;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

//获取工单状态信息
@Service("RemindTaskService")
public class RemindTaskServiceImpl implements RemindTaskService {

    @Autowired
    public RemindTaskTDao remindTaskTDao;
    @Autowired
    public WorkOrderRepairDao workOrderRepairDao;

    @Override
    public List<Map<String, Object>> getAssignStationTimeList(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getAssignStationTimeList(map);
    }

    @Override
    public List<Map<String, Object>> getAssignEngineerimeList1(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getAssignEngineerimeList1(map);
    }

    @Override
    public List<Map<String, Object>> getAssignEngineerimeList2(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getAssignEngineerimeList2(map);
    }

    @Override
    public List<Map<String, Object>> getReceiveTimeEngineerList1(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getReceiveTimeEngineerList1(map);
    }

    @Override
    public List<Map<String, Object>> getReceiveTimeEngineerList2(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getReceiveTimeEngineerList2(map);
    }

	@Override
	public List<Map<String, Object>> getRegionalServiceManager(String ServiceStationId,int wotChannel) {
		// TODO Auto-generated method stub
		return remindTaskTDao.getRegionalServiceManager(ServiceStationId,wotChannel);
	}

    @Override
    public List<Map<String, Object>> getAreaEngineerByServiceStationId(String ServiceStationId) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getAreaEngineerByServiceStationId(ServiceStationId);
    }

    @Override
    public List<Map<String, Object>> getSuccessWorkOrder(Map<String, Object> map) {
        // TODO Auto-generated method stub
        List<String> orderstatusList = StringToool.getStringList(MapUtils.getString(map, "orderstatus"), ",");
        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(orderstatusList)) {
            map.put("orderstatus", orderstatusList);
        } else {
            map.remove("orderstatus");
        }
        return remindTaskTDao.getSuccessWorkOrder(map);
    }

    @Override
    public List<Map<String, Object>> getNewWorkOrderList(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getNewWorkOrderList(map);
    }

    @Override
    public List<Map<String, Object>> getAreaEngineerWorkOrderList(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getAreaEngineerWorkOrderList(map);
    }


    @Override
    public List<Map<String, Object>> getWaitUserEvaluateWorkOrderList(Map<String, Object> map) {
        // TODO Auto-generated method stub
        return remindTaskTDao.getWaitUserEvaluateWorkOrderList(map);
    }

    @Override
    public List<Map<String, Object>> getToBeUpdatedWorkOrderList(Map<String, Object> map) {
        return remindTaskTDao.getToBeUpdatedWorkOrderList(map);
    }


    @Override
    public int saveMsgOperation(List<Map<String, Object>> list) {
        if (CollectionUtils.isNotEmpty(list)) {
            // TODO Auto-generated method stub
            return workOrderRepairDao.saveMsgOperation(list);
        }
        return 0;
    }


    @Override
    public List<Map<String, Object>> getCCECWaitFZZAuditAndVisitAndWaitFZZZGAudit(Map<String, Object> map) {
        return remindTaskTDao.getCCECWaitFZZAuditAndVisitAndWaitFZZZGAudit(map);
    }


    @Override
    public List<Map<String, Object>> getCCECServiceStationOverTimeWorkOrder(Map<String, Object> map) {
        return remindTaskTDao.getCCECServiceStationOverTimeWorkOrder(map);
    }

    @Override
    public List<Map<String, Object>> getManager(String ServiceStationId, int wotChannel) {
        return remindTaskTDao.getManager(ServiceStationId,wotChannel);
    }
}
